<%@page import="fr.pascal.calcul.CalculMetier"%>
<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
    pageEncoding="ISO-8859-1"%>

<% 
	double a = 0, b = 0, res = 0;
	String action = request.getParameter("action");
	if (action != null) {
		a = Double.parseDouble(request.getParameter("a"));
		b = Double.parseDouble(request.getParameter("b"));
		CalculMetier metier = new CalculMetier();
		if ("Somme".equals(action)) {
			res = metier.somme(a, b);
		} else {
			res = metier.produit(a, b);
		}
	}
%>
    
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>Insert title here</title>
</head>
<body>
	<form action="index.jsp" method="post">
		<table>
			<tr>
				<td>A:</td><td><input type="text" name="a" value="<%=a%>"></td>
			</tr>
			<tr>
				<td>B:</td><td><input type="text" name="b" value="<%=b%>"></td>
			</tr>
			<tr>
				<td><input type="submit" value="Somme" name="action"></td>
				<td colspan="3"><input type="submit" value="Produit" name="action"></td>
			</tr>
			<tr><td>Resultat=</td><td colspan="3"><%=res%></td></tr>
		</table>
	</form>
</body>
</html>